<template>
	<view class="sbody">
		<!-- 头部信息 -->
		<view class="top">
			<view class="top-midlle-line">
				<view class="top-table">
					<view class="top-cell">
						<!-- 头像 -->
						<view style="display: flex;;">
							<view class="top-avatar-frame"
								:style="{'background':'url('+userInfo.avatarUrl+')','background-size':'100% auto;','background-repeat':'no-repeat'}">
							</view>
							<view style="font-size: 20px;color: #fff;padding: 20px;">
								{{userInfo.nickName}}
							</view>
						</view>
					</view>
				</view>
				<view class="top-table">
					<!-- 设置 -->
					<span v-if="false" class="iconfont top-cell" style="color: white;font-size: 20px;">&#xe640;</span>
				</view>
			</view>
		</view>
		<!-- 功能选项 -->
		<view class="bottom">
			<view v-for="(item,index) in functionList" :key="index" style="position: relative;"
				@click="navigaterTo(item)">
				<span class="iconfont"
					style="position: absolute;top: 28%;left: 3%;color: #0971d3;">{{functionIconList[index]}}</span>
				<view class="choice_line">
					<view style="font-family:Microsoft YaHei;">{{item}}</view>
					<view><span class="iconfont" style="color: grey;">&#xe65c;</span></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//功能列表
				//functionList: ["个人服务", "身份认证", "访客预约记录", "会议室预定记录", "服务记录"],
				functionList: ["身份认证", "访客预约记录", "会议室预定记录", "服务记录"],
				//功能列表图标
				//functionIconList: ["\ue69b", "\ue6c8", "\ue666", "\ue75c", "\ue611"],
				functionIconList: ["\ue6c8", "\ue666", "\ue75c", "\ue611"],
				//登陆人信息
				userInfo: {
					avatarUrl: '',
					nickName: ''
				},
			}
		},
		methods: {
			chenked(type) {
				this.isActive = type
			},
			navigaterTo(data) {
				if (data.indexOf('访客预约记录') > -1) {
					uni.navigateTo({
						url: '../bookingRecord/bookingRecord?name=' + data
					})
				}
				if (data.indexOf('会议室预定记录') > -1) {
					uni.navigateTo({
						url: '../bookingRecord/bookingRecord?name=' + data
					})
				} else if (data.indexOf('身份认证') > -1) {
					uni.navigateTo({
						url: '../authentication/authentication'
					})
				} else if (data.indexOf('服务记录') > -1) {
					uni.navigateTo({
						url: '../warrantyManage/warrantyManage?name=' + data
					})
				}
			}
		},
		onLoad(options) {
			let userInfo = uni.getStorageSync("userInfo")
			this.userInfo.avatarUrl = userInfo.avatarUrl || userInfo.avatar
			this.userInfo.nickName = userInfo.nickName
		}

	}
</script>

<style>
	@import url("~@/static/font/iconfont.css");
	/* @import url("http://101.206.123.213:7051/static/font/iconfont.css"); */
</style>
<style lang="scss" scoped>
	.choice_line {
		text-indent: 30px;
		font-size: 12px;
		font-family: Microsoft YaHei;
		color: #444;
		display: flex;
		justify-content: space-between;
		border-bottom: 1px solid #eee;
		width: 94%;
		margin: auto;
		line-height: 40px;
	}

	.sbody {
		height: 100vh;
		background-color: white;
	}

	.top {
		height: 20%;
		font-size: 24rpx;
		background: url("http://101.206.123.213:7051/static/image/index/首页背景.png");
		background-size: 100% 300upx;
		/* 第一个值为宽，第二个值为高，当设置一个值时，将其作为图片宽度来等比缩放 */
		background-repeat: no-repeat;
		background-color: #147fe5;

		.top-midlle-line {
			display: flex;
			justify-content: space-between;
			margin-left: 10%;
			height: 100%;
			margin-right: 5%;
		}

		.top-table {
			display: table;
			height: 100%;
		}

		.top-cell {
			display: table-cell;
			vertical-align: middle;
		}

		.top-avatar-frame {
			border: 2px solid #3f9df6;
			height: 70px;
			width: 70px;
			border-radius: 50%;
		}
	}
</style>
